﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using WebChatServer.Models;

namespace WebChatServer.Controllers
{
    [HttpHeader("Access-Control-Allow-Origin", "*")]

    public class LoginController : ApiController
    {
        IMemberRepository _repository = new MemberRepository();
        ChatRepository chatRepository = new ChatRepository();

        public Login Post(Login login)
        {
            if(_repository.IsMember(login) == true)
            {
                chatRepository.Status(login.UserName, 1);
                return login;
            }
            return null;
        }

    }
}
